package leetcode.offer_two_special.integer;

/**
 * @author mazouri
 * @create 2021-09-04 21:43
 */
public class _03_countBits {
    public int[] countBits(int n) {
        int[] res = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            res[i] = res[i & (i-1)]+1;
        }
        return res;
    }
}
